package com.vanke.devops.domain.enums;

import com.vanke.core.exception.VankeBusinessException;
import lombok.Getter;

/**
 * @author 陈景阳
 * @since 2018/6/1
 */
@Getter
public enum  ZuulRouteErrorCode implements ErrorCode{
    ZUUL_ROUTE_PUBLISH_ERROR("0001","路由发布失败"),
    PATH_EXIST("0002","path已经存在"),
    HOST_LOCATION_EXIST("0003","host和location已经存在")
    ;
    private String code;
    private String message;

    ZuulRouteErrorCode(String code, String message) {
        this.code = code;
        this.message = message;
    }

    @Override
    public String getCode() {
        return ErrorCode.getErrorCodePrefix(ZuulRouteErrorCode.class) + code;
    }
    @Override
    public String getMessage() {
        return message;
    }

    public VankeBusinessException getException(){
        return new VankeBusinessException(this.getCode(), this.getMessage());
    }
}
